package cn.clx.ymcc.feign;

import cn.clx.ymcc.result.JSONResult;
import com.alibaba.fastjson.JSON;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseFeignBallbackFactory implements FallbackFactory<ICourseUserLearnFeignClient> {
    @Override
    public ICourseUserLearnFeignClient create(Throwable throwable) {
        return new ICourseUserLearnFeignClient() {
            @Override
            public JSONResult checkUserPermission(Long loginId, Long courseId) {
                return JSONResult.error("服务不可达，熔断了");
            }

            @Override
            public JSONResult get(Long id) {
                return JSONResult.error("服务不可达，熔断了");
            }

            @Override
            public JSONResult getOrderCourseinfo(String ids) {
                return JSONResult.error("服务不可达，熔断了");
            }
        };
    }
}
